package cn.ekgc.bmdsad.day3;

import java.util.List;

public class test1 {
    public static void main(String[] args) {
     /*                 最强王者
                傲视宗师1       傲视宗师2
            大师1  大师2  大师3           大师4
        璀璨钻石1 璀璨钻石2 璀璨钻石3 璀璨钻石4



        （不羁铁子1。。。。）


        ·根据当前节点获取父节点
        ·根据当前节点获取子节点
        根据当前节点获取所有祖先节点
        根据当前节点获取所有子孙节点
        ·根据当前节点获取所有兄弟节点
        */

     MyTree tree = new MyTree();
         tree.add(null,"最强王者");
        tree.add("最强王者","傲视宗师1");
        tree.add("最强王者","傲视宗师2");
        tree.add("傲视宗师1","大师1");
        tree.add("傲视宗师1","大师2");
        tree.add("傲视宗师1","大师3");
        tree.add("傲视宗师2","大师4");
        tree.add("大师1","璀璨钻石1");
        tree.add("大师1","璀璨钻石2");
        tree.add("大师1","璀璨钻石3");
        tree.add("大师1","璀璨钻石4");
        tree.addAll("璀璨钻石2","不羁铁子1","不羁铁子2","不羁铁子3");
        //父
        String parent = tree.getParent ( "大师1" );
        System.out.println (parent);
        //子
        List<String> children = tree.getChildren("璀璨钻石2");
        System.out.println (children);
        //children.forEach ( o-> System.out.println (o) );
        //兄弟
        List<String> sibing = tree.getSibling("璀璨钻石3");
        System.out.println (sibing);
        //祖先
//        List<String> ancestor = tree.getAncestor("大师1");
//        System.out.println (ancestor);
//        //子孙
//        List<String> descendant = tree.getDescendant("大师1");
//        System.out.println (descendant);


    }
}
